import sqlexecx
import asyncio
from config import MYSQL

async def hello():
    print("Hello world!")
    r = await asyncio.sleep(0, result=sqlexecx.select('select * from user where name in(?,?)', 'zhangsan', 'lisi'))
    print("Hello again!")


if __name__ == '__main__':
    sqlexecx.init(**MYSQL)
    sqlexecx.execute('truncate table user')
    loop = asyncio.get_event_loop()
    tasks = [hello(), hello()]
    loop.run_until_complete(asyncio.wait(tasks))
    loop.close()
